# from concurrent.futures import ProcessPoolExecutor
# from concurrent.futures import ThreadPoolExecutor
# import time
# import os
# import random
#
# def task(name):
#     print(name)
#     print(f'{os.getpid()} 准备接客')
#     time.sleep(random.randint(1,3))
#
#
# if __name__ == '__main__':
#
#     p = ProcessPoolExecutor()  # 设置进程数量默认为cpu个数
#     for i in range(23):
#         p.submit(task,1)  # 给进程池放任务,传参



from concurrent.futures import ProcessPoolExecutor
from concurrent.futures import ThreadPoolExecutor
import time
import os
import random

def task(name):
    print(name)
    print(f'{os.getpid()} 准备接客')
    time.sleep(random.randint(1,3))


if __name__ == '__main__':

    p = ThreadPoolExecutor()  # ,默认cpu数量*5
    for i in range(23):
        p.submit(task,1)  # 给进程池放任务,传参
